package org.example.dto;

import lombok.Data;

import java.awt.print.Printable;
import java.awt.print.PrinterJob;

@Data
public class PrintRequest {
    private String orderId;
    private Integer copies = 1;
    private Boolean cutPaper = true;

    public static void main(String[] args) throws Exception {
        PrinterJob job = PrinterJob.getPrinterJob();
        if (job.printDialog()) {
            job.setPrintable((graphics, pageFormat, pageIndex) -> {
                if (pageIndex > 0) return Printable.NO_SUCH_PAGE;
                graphics.drawString("TESTsds 汉印 PRINT", 100, 100);
                return Printable.PAGE_EXISTS;
            });
            job.print();
        }
    }
}
